package com.wtwd.device.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wtwd.device.model.entity.UpgradeFile;
import com.wtwd.device.model.entity.UpgradeStatement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface UpgradeMapper {
    /**
     * 新增一笔升级记录
     * @param data
     * @return
     */
    Integer addUpgradeInfo(@Param("data") UpgradeFile data);

    /**
     * 查询升级信息列表
     * @param userId
     * @return
     */
    IPage<UpgradeFile> getUpgradeInfoList(@Param("userId") Long userId ,@Param("watchId") String watchId, @Param("page") Page<Object> page);

    /**
     * 新增一笔升级说明
     * @param data
     * @return
     */
    Integer addUpgradeStatement(@Param("data") UpgradeStatement data);

    /**
     * 修改一笔升级说明
     * @param data
     * @return
     */
    Integer modifyUpgradeStatement(@Param("data") UpgradeStatement data);

    /**
     * 删除一笔升级说明
     * @param id
     * @return
     */
    Integer deleteUpgradeStatement(@Param("id") Integer id,@Param("watchId") String watchId);

    /**
     * 删除一笔升级说明
     * @return
     */
    List<Map<String,Object>> getLanguageList();

    /**
     * 根据手表id获取升级说明列表
     * @return
     */
    List<Map<String,Object>> getUpgradeStatementListByUpgradeId(@Param("upgradeId") Integer upgradeId);

    /**
     * 根据升级版本和手表id去找一条记录
     */
    Integer getUpgradeByWatchIdAndVersion(@Param("watchId") String watchId,@Param("version") String version);

    /**
     * 根据手表id模糊查询手表id列表
     */
    List<String> getWatchIdList(@Param("key") String key,@Param("userId") Long userId);

    Integer deleteUpgrade(Integer id);

    Integer deleteUpgradeStatementByUpgradeId(Integer upgradeId);

    List<UpgradeFile> getUpgradesByWatchId(@Param("watchId") String watchId);
}
